import http from '@/common/js/httpRequest'
//登录
export function loginByUser (userInfo) {
  return http({
    method: 'post',
    url: '/api/sys/login',
    data: userInfo
  })
}
//注销
export function logout () {
  return http({
    method: 'post',
    url: '/api/sys/logout'
  })
}
//修改密码
export function changePassword (data) {
  return http({
    method: 'post',
    url: '/api/sys/changepassword',
    data
  })
}
//员工列表
export function getUserList (params) {
  return http({
    method: 'get',
    url: '/api/sys/user/list',
    params
  })
}
//新增或修改员工
export function saveOrUpdateUser (user) {
	const urlRest = user.userId ? 'update' : 'save'
  return http({
    method: 'post',
    url: '/api/sys/user/' + urlRest,
    data: user
  })
}
//删除员工
export function deleteUser (ids) {
  return http({
    method: 'post',
    url: '/api/sys/user/delete',
    data: ids,
    openDefultdata: true
  })
}

//重置用户密码
export function resetPassword (id) {
  return http({
    method: 'post',
    url: '/api/sys/user/reset/'+id
  })
}
